package leetcode_1_200;

import java.util.List;

public class LeeCode_168 {
    public static void main(String[] args) {
        System.out.println(convertToTitle(28));
        System.out.println(convertToTitle(1));
        System.out.println(convertToTitle(701));
        System.out.println(convertToTitle(2147483647));
    }
    private static String convertToTitle(int columnNumber) {
        String ans = "";
        while (columnNumber != 0){
            int cur = (columnNumber - 1) % 26;
            char c;
            columnNumber -= 1;
            columnNumber /= 26;
            c = (char) ('A' + cur);
            ans = c + ans;
        }
        return ans;
    }
}
